#!/usr/bin/env python
# coding: utf-8

"""
For NSP --

This module is a simple case for support execute command from a text format command file.

Copyright (c) 2005-2009 UTStarcom, Inc.

2007-06-14, yubo.yang@utstar.com.
"""

# from onshs import BaseCase
from .basecase import BaseCase

class CMDCase (BaseCase):
    OPTIONS = [
        {
            'opt' : '--cmd-file',
            'dest': 'cmd_file',
            'metavar' : 'FILENAME',
            'help' : 'the file name of command text',
            'required' : True,
        },
    ]
    
    def __init__(self) :
        BaseCase.__init__(self)

    def execute(self) :
        # nr = NetRing()
        # ret = nr.mass_config(self.options.cmd_file)
        ret = True
        
        if ret :
            self.logger.info("Congratulations! %s executed successufully!" % self.options.cmd_file)
            self.succ_exit()
        else :
            self.logger.warning("Case (%s) was failed, and will exit!"%self.options.cmd_file) # 输出到日志
            self.failed_exit()  # Case 出错退出


if __name__ == "__main__" :
    case = CMDCase()
    case.execute()
    